/*
 * GwtYuiCarousel - API to integrate YUI Carousel in GWT framework
 *
 * Copyright (c) 2007, Nicolas Hoppenot
 *
 * This free software is licensed under the Apache License, Version 2.0 (the "License").
 * To obtain a copy of the licence, visit : http://www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed WITHOUT ANY WARRANTY OR CONDITION OF ANY KIND.
 * Please see the license for more information.
 *
 * Version $0.6.1-beta1$
 */
package com.gwtyuicarousel.client.ui;

import com.google.gwt.user.client.DOM;

/**
 * This class only permits to keep a reference to the Carousel instance.
 * 
 * @version $0.6.1-beta1$
 * @author Nicolas Hoppenot
 * 
 */
public class RequiredCarouselStructureImpl
    extends RequiredCarouselStructure {

  private Carousel carousel;

  /**
   * @see RequiredCarouselStructure#RequiredCarouselStructure(String, CarouselConfig)
   */
  public RequiredCarouselStructureImpl(String carouselId, CarouselConfig config) {
    super(carouselId, config);
  }

  /**
   * @see RequiredCarouselStructure#RequiredCarouselStructure(String)
   */
  public RequiredCarouselStructureImpl(String carouselId) {
    super(carouselId);
  }

  /**
   * Keep a reference of the carousel instance.
   * 
   * @see RequiredCarouselStructure#createCarousel()
   */
  protected void createCarousel() {
    carousel = new Carousel(DOM.getElementAttribute(getElement(), "id"), config);
  }

  /**
   * @return the carousel
   */
  public Carousel getCarousel() {
    return carousel;
  }

  /**
   * @param carousel
   *          the carousel to set
   */
  public void setCarousel(Carousel carousel) {
    this.carousel = carousel;
  }
}
